import React from 'react';
import { Drawer, Typography } from 'antd';
import AccessTable from '@/pages/Informal/containers/AccessTable';

const ProjectPreview = ({ visible, onVisibleChange, projectName, project, projectExplain }) => (
    <Drawer
        width={800}
        placement="right"
        closable={false}
        onClose={() => {
            if (onVisibleChange) onVisibleChange(false);
        }}
        visible={visible}
        bodyStyle={{ overflow: 'hidden', height: '100%', padding: 0 }}
    >
        <div style={{ display: 'flex', flexDirection: 'column', overflow: 'hidden', height: '100%' }}>
            <div
                style={{
                    display: 'flex',
                    flexDirection: 'column',
                    flex: 1,
                    margin: 24,
                    overflow: 'auto',
                    border: '1px solid #e8e8e8',
                    background: '#fafafa'
                }}
            >
                <div
                    style={{
                        width: '100%',
                        borderBottom: '1px solid #e8e8e8',
                        padding: '10px 16px',
                        background: '#FAFAFA'
                    }}
                >
                    <Typography.Title level={4} style={{ marginBottom: 0, textAlign: 'center' }}>
                        {projectName}
                    </Typography.Title>
                </div>
                <div
                    style={{
                        width: '100%',
                        borderBottom: '1px solid #e8e8e8',
                        display: 'flex',
                        padding: '10px 24px'
                    }}
                >
                    <div style={{ flex: 1 }}>
                        <strong>最终得分：</strong>自动计算
                    </div>
                    <div style={{ flex: 1 }}>
                        <strong>最终级别：</strong>自动计算
                    </div>
                </div>
                <div style={{ flex: 1, overflow: 'hidden' }}>
                    <AccessTable value={project} readOnly footer={() => <pre>{projectExplain}</pre>} />
                </div>
            </div>
        </div>
    </Drawer>
);

export default ProjectPreview;
